﻿using System;
using System.Diagnostics;
using CNav.Common;
using CNav.DataEntity;
using CNav.Domain;
using System.Collections.Generic;
using System.Linq;

namespace CNav.Business.Services
{
    public interface IGeneralService
    {
        IList<Country> GetCountries();
    }

    public class GeneralService : ServiceBase, IGeneralService
    {
        public GeneralService()
        {
            Debug.WriteLine("ctor: GeneralService");
        }

        public IList<Country> GetCountries()
        {
            var countryList = Context.Get<CountryDto>().ToList();

            return countryList.Select(c => new Country { ID = c.ID, Code = c.Code, Name = c.Name }).ToList();
        }
    }
}